
//
//  StrategyView.m
//  ErWa
//
//  Created by 王阳阳 on 16/3/9.
//  Copyright © 2016年 www.lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "StrategyView.h"


@implementation StrategyView

@synthesize titleLabel;

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        //上方的背景图片
        self.backImg = [[UIImageView alloc] initWithFrame:self.bounds];
        [self addSubview:_backImg];
        //加模糊效果
        UIBlurEffect *b = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
        UIVisualEffectView *effect = [[UIVisualEffectView alloc] initWithEffect:b];
        effect.frame = self.backImg.frame;
        effect.alpha = 0.8;
        [self.backImg addSubview:effect];       
        //用户头像
        self.userImg = [[UIImageView alloc] initWithFrame:CGRectMake(0, self.frame.size.height / 4 , self.frame.size.height / 4, self.frame.size.height / 4)];
        self.userImg.center = CGPointMake(self.frame.size.height / 4, _userImg.center.y);
        [self addSubview:_userImg];
        _userImg.layer.cornerRadius = _userImg.frame.size.width / 2;
        _userImg.clipsToBounds = YES;
        //用户名
        self.nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, _userImg.frame.origin.y + _userImg.frame.size.height + 5, self.frame.size.width, self.frame.size.height / 8)];
        _nameLabel.textColor = [UIColor whiteColor];
        _nameLabel.textAlignment = NSTextAlignmentCenter;
        [self addSubview:_nameLabel];
        _nameLabel.font = [UIFont systemFontOfSize:15];
        
        //文章名称
        self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, _nameLabel.frame.origin.y + _nameLabel.frame.size.height + 5, _nameLabel.frame.size.width, _nameLabel.frame.size.height)];
        [self addSubview:self.titleLabel];
        self.titleLabel.textColor = [UIColor whiteColor];
        self.titleLabel.textAlignment = NSTextAlignmentCenter;
    }
    return self;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
